<!DOCTYPE html>
<html>
<?php //var_dump($output);exit;?>
<head>
    <meta charset="utf-8">
    <title>金贵银业</title>
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <!--标准mui.css-->
    <link rel="stylesheet" href="<?php echo MOBILE_RESOURCE_SITE_URL; ?>/css/mui.min.css">
    <!--App自定义的css-->
    <link rel="stylesheet" type="text/css" href="<?php echo MOBILE_RESOURCE_SITE_URL; ?>/css/app.css" />
    <!--App自定义的css-->
    <link rel="stylesheet" type="text/css" href="<?php echo MOBILE_RESOURCE_SITE_URL; ?>/css/zhaojinyin_index.css" />
    <link href="<?php echo MOBILE_RESOURCE_SITE_URL; ?>/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <script src="<?php echo MOBILE_RESOURCE_SITE_URL; ?>/js/mui.min.js"></script>
    <style>
        .mui-control-content {
            background-color: white;
            min-height: 215px;
        }

        .mui-control-content .mui-loading {
            margin-top: 50px;
        }

        a.mui-active {
            border-bottom: 2px solid #BB9E77 !important;
            color: #BB9E77 !important;
        }
    </style>
    <script type="text/javascript" charset="utf-8">
        mui.init({
            swipeBack: true //启用右滑关闭功能
        });

    </script>
</head>

<body style="padding-bottom: 150px;">

<div class="mui-bar" style="height: 45px;top: 0;">
    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
    <!--
        时间：2016-03-24
        描述：右边按钮
        <a class="mui-icon mui-pull-right right-btn"><span class="mui-badge">36</span></a>
    -->
    <h1 class="mui-title">我的订单</h1>
</div>

<div class="mui-content" style="margin-top: 46px;">
    <div>
        <div id="segmentedControl" class="mui-segmented-control mui-segmented-control-inverted">
            <a class="mui-control-item mui-active" href="#item1">
                全部
            </a>
            <a class="mui-control-item" href="#item2">
                待付款
            </a>
            <a class="mui-control-item" href="#item3mobile">
                待发货
            </a>
            <a class="mui-control-item" href="#item4mobile">
                待收货
            </a>
            <a class="mui-control-item" href="#item5mobile">
                待评价
            </a>
        </div>

        <div class="mui-slider-group">
            <div id="item1" class="mui-slider-item mui-control-content mui-active" style="padding-bottom: 100px;height: 2000px;  ">
                <div id="scroll1" class="mui-scroll-wrapper">
                    <!--
                        作者：569154771@qq.com
                        时间：2016-04-05
                        描述：全部
                    -->
                    <div class="mui-scroll">

                        <?php foreach($output['order_group_list'] as $g){?>
                        <div>

                            <div style="width: 100%; height: 6px; background: #EEEEEE;"></div>

                           <?php foreach($g['order_list'] as $o){;?>

                            <div style="padding: 10px;">
                                <label style="line-height: 25px; width: 100%;">
                                    <img src="<?php echo MOBILE_RESOURCE_SITE_URL; ?>/images/03.png" style="width: 20px; vertical-align: middle; margin-right: 10px;"><?php echo $g['order_list']['0']['store_name'];?> >
                                    <label> 订单编号: <?php echo $o['order_sn'];?></label>
                                    <label style="float: right; color: #BB9E77;"><?php echo $o['state_desc'];?></label>
                                    <div style="padding: 10px;"> 下单时间：<?php echo date('Y-m-d H:i:s',$o['add_time']);?>  </div>
                                </label>
                            </div>
                           <?php foreach($o['extend_order_goods'] as $goods){ ?>
                            <div style="background: #F6F6F6; float: left; width: 100%;padding: 10px;">
                                <img style="width:100px; float: left;margin-right: 10px;" src="/data/upload/shop/store/goods/<?php echo $goods['store_id'];?>/<?php echo $goods['goods_image'];?>" />
                                <div style="float: left; width: 62%;">
                                    <h5 style="color: #333333;"><?php echo $goods['goods_name'];?></h5>

                                    <div style="line-height: 5px;"><span class="color_red">￥<?php echo $goods['goods_pay_price'];?></span>&nbsp;&nbsp;<span style="float: right;">X<?php echo $goods['goods_num'];?></span></div>
                                </div>
                            </div>
                            <?php }?>
                            <p class="font_sz_14" style="text-align: right; color: #333333; line-height: 45px;border-bottom: 1px solid #DDDDDD;">共<?php echo count($o['extend_order_goods']);?>件商品 &nbsp; 合计：<?php echo $o['order_amount'];?> （含运费<?php echo $o['shipping_fee'];?>）</p>

                            <div style=" text-align:right; padding:0 10px 10px 10px;">
                                <?php if($g['order_list']['0']['state_desc']=='待付款'){?>
                                    <!--button type="button" class="mui-btn mui-btn-outlined">
                                        联系卖家
                                    </button-->
                                    <button type="button" class="mui-btn mui-btn-outlined cancel-order" order_id="<?php echo $o['order_id'];?>">
                                        取消订单
                                    </button>
                                    <?php if($g['pay_amount'] && $g['pay_amount']>0){?>
                                    <button type="button" class="mui-btn mui-btn-warning mui-btn-outlined" onclick="window.location.href='index.php?act=member_payment&op=pay&pay_sn=<?php echo $o['pay_sn'];?>&key=<?php echo $_COOKIE['key'];?>';">
                                        付款
                                    </button>
                                   <?php }?>
                                <?php }?>
                                <?php if($g['order_list']['0']['state_desc']=='待发货'){?>
                                    <!--button type="button" class="mui-btn mui-btn-outlined">
                                        联系卖家
                                    </button-->
                                    <button type="button" class="mui-btn mui-btn-outlined">
                                        退款/退货
                                    </button>
                                <?php }?>
                                <?php if($g['order_list']['0']['state_desc']=='待收货'){?>
                                    <!--button type="button" class="mui-btn mui-btn-outlined">
                                        联系卖家
                                    </button-->
                                    <button type="button" class="mui-btn mui-btn-outlined">
                                        退款/退货
                                    </button>
                                    <button type="button" class="mui-btn mui-btn-warning mui-btn-outlined">
                                        确认收货
                                    </button>
                                <?php }?>
                                <?php if($g['order_list']['0']['state_desc']=='待评价'){?>
                                    <button type="button" class="mui-btn mui-btn-outlined">
                                        删除订单
                                    </button>
                                    <button type="button" id="pingluen" class="mui-btn mui-btn-warning mui-btn-outlined">
                                        评论
                                    </button>
                                <?php }?>
                                <?php if($g['order_list']['0']['state_desc']=='交易完成'){?>
                                    <div style=" text-align:right; padding:0 10px 10px 10px;">
                                        <button type="button" class="mui-btn mui-btn-outlined">
                                            删除订单
                                        </button>
                                        <button type="button" id="pingluen" class="mui-btn mui-btn-warning mui-btn-outlined">
                                            评论
                                        </button>

                                    </div>
                                <?php }?>
                                <?php }?>
                            </div>
                        </div>
                        <?php }?>
                        <!--
                            作者：569154771@qq.com
                            时间：2016-04-05
                            描述：还没有订单
                        -->
                        <?php if(!$output['order_group_list']){?>
                        <div style=" text-align: center; height: 400px;">
                            <img style="width: auto; margin: 10px auto;" src="<?php echo MOBILE_RESOURCE_SITE_URL; ?>/images/dd15.png" />
                            <h4>您还没有相关的订单</h4>
                            <p>可以去看看有哪些想买的</p>
                        </div>
<!--                        <img style="width: 100%;" src="--><?php //echo MOBILE_RESOURCE_SITE_URL; ?><!--/images/meidindan_03.jpg">-->

                        <?php }?>
                    </div>
                </div>

            </div>

            <div id="item2" class="mui-slider-item mui-control-content" style="height: 2000px;" >
                <div id="scroll2" class="mui-scroll-wrapper">
                    <!--
                        作者：569154771@qq.com
                        时间：2016-04-05
                        描述：待付款
                    -->
                    <div class="mui-scroll">

                        <?php foreach($output['order_group_list'] as $g){ if($g['order_list']['0']['state_desc']=='待付款'){?>
                        <div>
                            <div style="width: 100%; height: 6px; background: #EEEEEE;"></div>
                            <div style="padding: 10px;">

                                <label style="line-height: 25px; width: 100%;">
                                    <img src="<?php echo MOBILE_RESOURCE_SITE_URL; ?>/images/03.png" style="width: 20px; vertical-align: middle; margin-right: 10px;"><?php echo $g['order_list']['0']['store_name'];?> >
                                    <label style="float: right; color: #BB9E77;"><?php echo $g['order_list']['0']['state_desc'];?></label>
                                    <div style="padding: 10px;"> 下单时间：<?php echo date('Y-m-d H:i:s',$g['order_list']['0']['add_time']);?>  </div>
                                </label>
                            </div>

                            <div style="background: #F6F6F6; float: left; width: 100%;padding: 10px;">
                                <img style="width:100px; float: left;margin-right: 10px;" src="/data/upload/shop/store/goods/1/<?php echo $g['order_list']['0']['extend_order_goods']['0']['goods_image'];?>" />
                                <div style="float: left; width: 62%;">
                                    <h5 style="color: #333333;"><?php echo $g['order_list']['0']['extend_order_goods']['0']['goods_name'];?></h5>
                                    <p><?php ?></p>
                                    <div style="line-height: 5px;"><span class="color_red">￥<?php echo $g['order_list']['0']['extend_order_goods']['0']['goods_pay_price'];?></span>&nbsp;&nbsp;<span style="float: right;">X<?php echo $g['order_list']['0']['extend_order_goods']['0']['goods_num'];?></span></div>
                                </div>
                            </div>
                            <p class="font_sz_14" style="text-align: right; color: #333333; line-height: 45px;border-bottom: 1px solid #DDDDDD;">共<?php echo $g['order_list']['0']['extend_order_goods']['0']['goods_num'];?>件商品 &nbsp; 合计：<?php echo $g['order_list']['0']['extend_order_goods']['0']['goods_pay_price'];?> （含运费0.00）</p>

                            <div style=" text-align:right; padding:0 10px 10px 10px;">
                                <!--button type="button" class="mui-btn mui-btn-outlined">
                                    联系卖家
                                </button-->
                                <button type="button" class="mui-btn mui-btn-outlined ">
                                    取消订单
                                </button>
                                <button type="button" class="mui-btn mui-btn-warning mui-btn-outlined">
                                    付款
                                </button>
                            </div>
                        </div>
                        <?php }}?>
                    </div>
                </div>

            </div>
            <div id="item3mobile" class="mui-slider-item mui-control-content" style="height: 2000px;">
                <div id="scroll3" class="mui-scroll-wrapper">
                    <div class="mui-scroll">
                        <!--
                            作者：569154771@qq.com
                            时间：2016-04-05
                            描述：待发货
                        -->

                        <?php foreach($output['order_group_list'] as $g){ if($g['order_list']['0']['state_desc']=='待发货'){?>
                        <div>
                            <div style="width: 100%; height: 6px; background: #EEEEEE;"></div>
                            <div style="padding: 10px;">

                                <label style="line-height: 25px; width: 100%;">
                                    <img src="<?php echo MOBILE_RESOURCE_SITE_URL; ?>/images/03.png" style="width: 20px; vertical-align: middle; margin-right: 10px;"><?php echo $g['order_list']['0']['store_name'];?> >
                                    <label style="float: right; color: #BB9E77;"><?php echo $g['order_list']['0']['state_desc'];?></label>
                                    <div style="padding: 10px;"> 下单时间：<?php echo date('Y-m-d H:i:s',$o['add_time']);?>  </div>
                                </label>
                            </div>

                            <div style="background: #F6F6F6; float: left; width: 100%;padding: 10px;">
                                <img style="width:100px; float: left;margin-right: 10px;" src="/data/upload/shop/store/goods/1/<?php echo $g['order_list']['0']['extend_order_goods']['0']['goods_image'];?>" />
                                <div style="float: left; width: 62%;">
                                    <h5 style="color: #333333;"><?php echo $g['order_list']['0']['extend_order_goods']['0']['goods_name'];?></h5>
                                    <p><?php ?></p>
                                    <div style="line-height: 5px;"><span class="color_red">￥<?php echo $g['order_list']['0']['extend_order_goods']['0']['goods_pay_price'];?></span>&nbsp;&nbsp;<span style="float: right;">X<?php echo $g['order_list']['0']['extend_order_goods']['0']['goods_num'];?></span></div>
                                </div>
                            </div>
                            <p class="font_sz_14" style="text-align: right; color: #333333; line-height: 45px;border-bottom: 1px solid #DDDDDD;">共<?php echo $g['order_list']['0']['extend_order_goods']['0']['goods_num'];?>件商品 &nbsp; 合计：<?php echo $g['order_list']['0']['extend_order_goods']['0']['goods_pay_price'];?> （含运费0.00）</p>

                            <div style=" text-align:right; padding:0 10px 10px 10px;">
                                <!--button type="button" class="mui-btn mui-btn-outlined">
                                    联系卖家
                                </button-->
                                <button type="button" class="mui-btn mui-btn-outlined">
                                    退款/退货
                                </button>

                            </div>
                        </div>
                        <?php }}?>

                    </div>

                </div>

            </div>

            <div id="item4mobile" class="mui-slider-item mui-control-content" style="height: 2000px;">
                <div id="scroll4" class="mui-scroll-wrapper">
                    <!--
                        作者：569154771@qq.com
                        时间：2016-04-05
                        描述：待收货
                    -->
                    <div class="mui-scroll">

                        <?php foreach($output['order_group_list'] as $g){ if($g['order_list']['0']['state_desc']=='待收货'){?>
                            <div>
                                <div style="width: 100%; height: 6px; background: #EEEEEE;"></div>
                                <div style="padding: 10px;">

                                    <label style="line-height: 25px; width: 100%;">
                                        <img src="<?php echo MOBILE_RESOURCE_SITE_URL; ?>/images/03.png" style="width: 20px; vertical-align: middle; margin-right: 10px;"><?php echo $g['order_list']['0']['store_name'];?> >
                                        <label style="float: right; color: #BB9E77;"><?php echo $g['order_list']['0']['state_desc'];?></label>
                                        <div style="padding: 10px;"> 下单时间：<?php echo date('Y-m-d H:i:s',$g['order_list']['0']['add_time']);?>  </div>
                                    </label>
                                </div>

                                <div style="background: #F6F6F6; float: left; width: 100%;padding: 10px;">
                                    <img style="width:100px; float: left;margin-right: 10px;" src="/data/upload/shop/store/goods/1/<?php echo $g['order_list']['0']['extend_order_goods']['0']['goods_image'];?>" />
                                    <div style="float: left; width: 62%;">
                                        <h5 style="color: #333333;"><?php echo $g['order_list']['0']['extend_order_goods']['0']['goods_name'];?></h5>
                                        <p><?php ?></p>
                                        <div style="line-height: 5px;"><span class="color_red">￥<?php echo $g['order_list']['0']['extend_order_goods']['0']['goods_pay_price'];?></span>&nbsp;&nbsp;<span style="float: right;">X<?php echo $g['order_list']['0']['extend_order_goods']['0']['goods_num'];?></span></div>
                                    </div>
                                </div>
                                <p class="font_sz_14" style="text-align: right; color: #333333; line-height: 45px;border-bottom: 1px solid #DDDDDD;">共<?php echo $g['order_list']['0']['extend_order_goods']['0']['goods_num'];?>件商品 &nbsp; 合计：<?php echo $g['order_list']['0']['extend_order_goods']['0']['goods_pay_price'];?> （含运费0.00）</p>

                                <div style=" text-align:right; padding:0 10px 10px 10px;">
                                    <!--button type="button" class="mui-btn mui-btn-outlined">
                                        联系卖家
                                    </button-->
                                    <button type="button" class="mui-btn mui-btn-outlined">
                                        退款/退货
                                    </button>

                                </div>
                            </div>
                        <?php }}?>
                    </div>


                </div>

            </div>

            <div id="item5mobile" class="mui-slider-item mui-control-content" style="height: 2000px;">
                <div id="scroll5" class="mui-scroll-wrapper">
                    <!--
                        作者：569154771@qq.com
                        时间：2016-04-05
                        描述：待评价
                    -->
                    <div class="mui-scroll">

                        <?php foreach($output['order_group_list'] as $g){ if($g['order_list']['0']['state_desc']=='交易完成'){?>
                            <div>
                                <div style="width: 100%; height: 6px; background: #EEEEEE;"></div>
                                <div style="padding: 10px;">

                                    <label style="line-height: 25px; width: 100%;">
                                        <img src="<?php echo MOBILE_RESOURCE_SITE_URL; ?>/images/03.png" style="width: 20px; vertical-align: middle; margin-right: 10px;"><?php echo $g['order_list']['0']['store_name'];?> >
                                        <label style="float: right; color: #BB9E77;"><?php echo $g['order_list']['0']['state_desc'];?></label>
                                        <div style="padding: 10px;"> 下单时间：<?php echo date('Y-m-d H:i:s',$g['order_list']['0']['add_time']);?>  </div>
                                    </label>
                                </div>

                                <div style="background: #F6F6F6; float: left; width: 100%;padding: 10px;">
                                    <img style="width:100px; float: left;margin-right: 10px;" src="/data/upload/shop/store/goods/1/<?php echo $g['order_list']['0']['extend_order_goods']['0']['goods_image'];?>" />
                                    <div style="float: left; width: 62%;">
                                        <h5 style="color: #333333;"><?php echo $g['order_list']['0']['extend_order_goods']['0']['goods_name'];?></h5>
                                        <p><?php ?></p>
                                        <div style="line-height: 5px;"><span class="color_red">￥<?php echo $g['order_list']['0']['extend_order_goods']['0']['goods_pay_price'];?></span>&nbsp;&nbsp;<span style="float: right;">X<?php echo $g['order_list']['0']['extend_order_goods']['0']['goods_num'];?></span></div>
                                    </div>
                                </div>
                                <p class="font_sz_14" style="text-align: right; color: #333333; line-height: 45px;border-bottom: 1px solid #DDDDDD;">共<?php echo $g['order_list']['0']['extend_order_goods']['0']['goods_num'];?>件商品 &nbsp; 合计：<?php echo $g['order_list']['0']['extend_order_goods']['0']['goods_pay_price'];?> （含运费0.00）</p>

                                <div style=" text-align:right; padding:0 10px 10px 10px;">
                                    <button type="button" class="mui-btn mui-btn-outlined">
                                        删除订单
                                    </button>
                                    <button type="button" id="pingluen" class="mui-btn mui-btn-warning mui-btn-outlined">
                                        评论
                                    </button>

                                </div>
                            </div>
                        <?php }}?>
                    </div>

                </div>

            </div>
           
        </div>
    </div>


</div>

<script type="text/javascript" src="<?php echo BASE_SITE_URL;?>/wap/js/config.js"></script>
<script type="text/javascript" src="<?php echo BASE_SITE_URL;?>/wap/js/zepto.min.js"></script>
<script type="text/javascript" src="<?php echo BASE_SITE_URL;?>/wap/js/template.js"></script>
<script type="text/javascript" src="<?php echo BASE_SITE_URL;?>/wap/js/common.js"></script>
<script type="text/javascript" src="<?php echo BASE_SITE_URL;?>/wap/js/simple-plugin.js"></script>
<script type="text/javascript" src="<?php echo BASE_SITE_URL;?>/wap/js/tmpl/common-top.js"></script>
<script type="text/javascript" src="<?php echo BASE_SITE_URL;?>/wap/js/tmpl/footer.js"></script>
<script type="text/javascript">
    //取消订单

    function getcookie(name){
        var strcookie=document.cookie;
        var arrcookie=strcookie.split("; ");
        for(var i=0;i<arrcookie.length;i++){
            var arr=arrcookie[i].split("=");
            if(arr[0]==name)return arr[1];
        }
        return "";
    }

    var member_id = "<?php echo $_SESSION['member_id'];?>";
    var key = getcookie('key');
    if(member_id==''){
        window.location.href = WapSiteUrl+'index.php?act=login';
    }

    function cancelOrder(){
        var self = $(this);
        var order_id = self.attr("order_id");
        $.ajax({
            type:"post",
            url:ApiUrl+"/index.php?act=member_order&op=order_cancel",
            data:{order_id:order_id,key:key},
            dataType:"json",
            success:function(result){
                if(result.datas && result.datas == 1){
                   window.location.reload();
                }
            }
        });
    }


    $(function(){
        $(".cancel-order").click(cancelOrder);
    })
</script>


</body>

</html>